import { apiGet, apiPost } from '../func/fetch'
import type { DetailsData, TerminalUserData } from './type'
import type { PageResult } from '@/api/global.ts'
import { ContentType } from '@/api/global.ts'

const _api = import.meta.env.VITE_FACEID_URL

// 终端分页
export const terminalUserApi = (params): Promise<PageResult<TerminalUserData>> => {
  return apiGet(`${_api}/terminal-user/page`, params)
}
// 新增终端用户
export const addUserApi = (params): Promise<null> => {
  return apiPost(`${_api}/terminal-user/addUser`, params, ContentType.APPLICATION_JSON)
}
//  编辑
export const editUserApi = (params): Promise<null> => {
  return apiPost(`${_api}/terminal-user/update`, params, ContentType.APPLICATION_JSON)
}
// 删除
export const delectUserApi = (params: { id: string }): Promise<null> => {
  return apiPost(`${_api}/terminal-user/delete`, params)
}
// 重置密码
export const resetPasswordApi = (params: { id: string }): Promise<null> => {
  return apiPost(`${_api}/terminal-user/reset-password`, params)
}
// 详情
export const detailApi = (params: { id: string }): Promise<DetailsData> => {
  return apiGet(`${_api}/terminal-user/detail`, params)
}
// 是否禁用
export const statusChangeApi = (params: { id: string, disable: boolean }): Promise<null> => {
  return apiPost(`${_api}/terminal-user/status`, params)
}
